<?php

/**
 * Cheltuiala form base class.
 *
 * @method Cheltuiala getObject() Returns the current form's model object
 *
 * @package    acap
 * @subpackage form
 * @author     Verminu
 */
abstract class BaseCheltuialaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'user_id'           => new sfWidgetFormPropelChoice(array('model' => 'User', 'add_empty' => false)),
      'luna'              => new sfWidgetFormInputText(),
      'tip_cheltuiala_id' => new sfWidgetFormPropelChoice(array('model' => 'TipCheltuiala', 'add_empty' => false)),
      'furnizor'          => new sfWidgetFormInputText(),
      'data_emiterii'     => new sfWidgetFormDate(),
      'scadenta'          => new sfWidgetFormDate(),
      'descriere'         => new sfWidgetFormInputText(),
      'serie'             => new sfWidgetFormInputText(),
      'valoare'           => new sfWidgetFormInputText(),
      'coloana_id'        => new sfWidgetFormPropelChoice(array('model' => 'Coloana', 'add_empty' => false)),
      'target_id'         => new sfWidgetFormPropelChoice(array('model' => 'Target', 'add_empty' => false)),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'user_id'           => new sfValidatorPropelChoice(array('model' => 'User', 'column' => 'id')),
      'luna'              => new sfValidatorInteger(array('min' => -32768, 'max' => 32767)),
      'tip_cheltuiala_id' => new sfValidatorPropelChoice(array('model' => 'TipCheltuiala', 'column' => 'id')),
      'furnizor'          => new sfValidatorString(array('max_length' => 64)),
      'data_emiterii'     => new sfValidatorDate(),
      'scadenta'          => new sfValidatorDate(array('required' => false)),
      'descriere'         => new sfValidatorString(array('max_length' => 128)),
      'serie'             => new sfValidatorString(array('max_length' => 32)),
      'valoare'           => new sfValidatorNumber(),
      'coloana_id'        => new sfValidatorPropelChoice(array('model' => 'Coloana', 'column' => 'id')),
      'target_id'         => new sfValidatorPropelChoice(array('model' => 'Target', 'column' => 'id')),
      'created_at'        => new sfValidatorDateTime(array('required' => false)),
      'updated_at'        => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('cheltuiala[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Cheltuiala';
  }


}
